<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class fields extends MX_Controller {

    function __construct() {
        parent::__construct();

        $this->load->model('business_field');
        $this->load->library('pagination');
        date_default_timezone_set('Asia/Ho_Chi_Minh');
    }

    function index($row = 0) {
        //paging
        include('paging.php');
        $config['per_page'] = 2;
        $config['base_url'] = base_url() . "linh-vuc/";

        $lst_fields = $this->business_field->get(-1, $config['per_page'], $row);
        $config['total_rows'] = $this->business_field->total_count();

        $config['cur_page'] = $row;
        $this->pagination->initialize($config);
        $data['list_link'] = $this->pagination->create_links();
        //data tranfer        
        $data['lst_fields'] = $lst_fields;

        $data['content'] = 'fields_index';
        $this->load->view('template/template', $data);
    }

    function detail($permalink) {
        $field = $this->business_field->get_by_permalink($permalink);
        $data['field'] = $field;

        $data['content'] = 'fields_detail';
        $this->load->view('template/template', $data);
    }

}
?>

